package recognyze.anthropometry;

public class Vector {
    private int myX;
    private int myY;

    public Vector(int x, int y) {
        myX = x;
        myY = y;
    }

    public int getMyX() {
        return myX;
    }

    public void setMyX(int myX) {
        this.myX = myX;
    }

    public int getMyY() {
        return myY;
    }

    public void setMyY(int myY) {
        this.myY = myY;
    }

    @Override
    public boolean equals(Object obj) {
        if (obj == null) {
            return false;
        }
        if (getClass() != obj.getClass()) {
            return false;
        }
        final Vector other = (Vector) obj;
        if(myX != other.myX || myY != other.myY) {
            return false;
        }
        return true;
    }

    @Override
    public int hashCode() {
        int hash = 7;
        hash = 37 * hash + this.myX;
        hash = 37 * hash + this.myY;
        return hash;
    }

    public Vector diff(Vector p) {
        return new Vector(myX - p.myX, myY - p.myY);
    }

    public Vector add(Vector p) {
        return new Vector(myX + p.myX, myY + p.myY);
    }
}
